package com.cn.studey.listeningmessage.rocketmqmessage;

import com.cn.studey.entity.mqentity.MqMessage;
import com.cn.studey.listeningmessage.rocketmqmessage.DealMessageimpl.A;
import com.cn.studey.listeningmessage.rocketmqmessage.DealMessageimpl.B;
import org.apache.commons.lang3.StringUtils;

/**
 * @author mjy(处理消息工厂)
 * @date 2021/12/20
 * @description
 */

public class DelMessageFactory {


    public static DealMessage createDealMessage(MqMessage mqMessage) {

        if (mqMessage==null|| StringUtils.isBlank(mqMessage.getType())){
            return null;
        }
        DealMessage dealMessage = null;
        if (mqMessage.getType().equals("A")) {
            dealMessage = new A();
        } else if (mqMessage.getType().equals("B")) {
            dealMessage = new B();
        }
        return dealMessage;
    }
}
